<%@ page contentType="text/html;charset=UTF-8" trimDirectiveWhitespaces="true"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/constrant.jsp"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/WEB-INF/views/wx/include/head.jsp" %>
</head>
<body>
	<header class="mui-bar mui-bar-nav">
		<a href="${ctxWx}/pu/my" class="mui-icon mui-icon-left-nav mui-pull-left"></a>
		<button id="history" class="mui-btn mui-btn-blue mui-btn-link mui-pull-right">历史</button>
		<h1 class="mui-title">定制包车</h1>
	</header>
	<div class="mui-content">
		<div class="mui-segmented-control mui-segmented-control-inverted">
			<a class="mui-control-item tabType ${tDemands.reactstatus eq 2?'mui-active':'' }" data-href="${ctxWx}/pu/demands/list?reactstatus=2">已响应</a>
			<a class="mui-control-item tabType ${tDemands.reactstatus eq 1?'mui-active':'' }" data-href="${ctxWx}/pu/demands/list?reactstatus=1">未响应</a>
		</div>
		<ul class="mui-table-view mui-table-view-striped mui-table-view-condensed">
			<c:forEach items="${page.list}" var="tDemands">
				<li class="mui-table-view-cell" data-demandid="${tDemands.demandid}">
					<div class="mui-pull-left">
						<p style="color:#000000;">${tDemands.departcity.sitename}-${tDemands.destcity.sitename}（${tDemands.cartype.typename}）</p>
						<p><fmt:formatDate value="${tDemands.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></p>
					</div>
					<div class="mui-pull-right">
						<button id="cancelBtn" class="mui-btn mui-btn-primary" data-value="${tDemands.demandid }">取消</button>
					</div>
				</li>
			</c:forEach>
		</ul>
		<c:if test="${empty page.list}">
			<p class="nodata-tip">没有未响应订单</p>
		</c:if>
	</div>
	<%@ include file="/WEB-INF/views/wx/include/script.jsp"%>
	<script type="text/javascript">
		$(function(){
			$('.tabType').on('tap',function(){
				var href=$(this).attr('data-href');
				if(href){
					window.location.href=href;
				}
			});
			$('li.mui-table-view-cell').on('tap',function(e){
				window.location.href='${ctxWx}/pu/demands/view?demandid='+$(this).attr('data-demandid');
			});
			$('#cancelBtn').on('tap',function(e){
				e.stopPropagation();
				var value = $(this).attr('data-value');
				var btnArray = ['否', '是'];
				mui.confirm('是否取消该定制包车需求？', '警告', btnArray, function(e) {
					if (e.index == 1) {
						window.location.href='${ctxWx }/pu/demands/cancel?demandid='+value;
					}
				});
				return false;
			});
			$('#history').on('tap',function(){
				window.location.href='${ctxWx}/pu/demands/list?history=yes';
			});
		})
	</script>
</body>
</html>